<div class="modal-header">
    <h3 ng-click="cancel()">
        Runs for
        <ot-entity-image entity="validation.validationStamp" link="#/validationStamp/{{validation.validationStamp.id}}">
            {{validation.validationStamp.name}}
        </ot-entity-image>
        in build
        <a href="#/build/{{build.id}}">
            {{build.name}}
        </a>
    </h3>
</div>
<div class="modal-body">
    <div class="panel panel-default" ng-show="loadingValidationRuns">
        <div class="alert alert-info">
            <span class="ot-loading-indicator"></span>
            Loading the validation runs...
        </div>
    </div>
    <div class="panel panel-default" ng-if="validation.validationStamp.dataType">
        <div class="panel-body">
            <ot-validation-data-type-config value="validation.validationStamp.dataType"></ot-validation-data-type-config>
        </div>
    </div>
    <div class="panel panel-default"
         ng-hide="loadingValidationRuns"
         ng-repeat="validationRun in validation.validationStamp.validationRunsPaginated.pageItems | orderBy:'id':true">
        <div class="panel-heading">
            <a href="#/validationRun/{{validationRun.id}}" ng-click="cancel()">
            Run #{{validationRun.runOrder}}
            </a>
            <p class="ot-command pull-right" ng-if="validationRun.links._validationRunStatusChange" title="Change status"
                    ng-click="changeStatus(validationRun)">
                <span class="fa fa-comment-o"></span>
            </p>
        </div>
        <div class="panel-body" ng-if="validationRun.data">
            <ot-validation-run-data value="validationRun.data"></ot-validation-run-data>
        </div>
        <ul class="list-group">
            <li class="list-group-item" ng-repeat="validationRunStatus in validationRun.validationRunStatuses">
                <ot-validation-run-status status="validationRunStatus"></ot-validation-run-status>
                {{validationRunStatus.statusID.name}}
                <p class="pull-right">
                    <span class="ot-signature">
                        <span>{{validationRunStatus.creation.user}} @ </span>
                        {{validationRunStatus.creation.time | date:'mediumDate' }}
                        <span>{{validationRunStatus.creation.time | date:'shortTime' }}</span>
                    </span>
                </p>
                <p>
                    <ot-validation-run-status-comment status="validationRunStatus"></ot-validation-run-status-comment>
                </p>
            </li>
        </ul>
        <div class="panel-body" ng-if="validationRun.runInfo">
            <div class="row">
                <div class="col-md-4">
                    <span ng-if="validationRun.runInfo.sourceType && validationRun.runInfo.sourceUri">
                        Source: <a href="{{validationRun.runInfo.sourceUri}}">{{validationRun.runInfo.sourceType}}</a>
                    </span>
                </div>
                <div class="col-md-4">
                    <span ng-if="validationRun.runInfo.triggerType && validationRun.runInfo.triggerData">
                        Trigger: {{validationRun.runInfo.triggerType}}
                        ->
                        {{validationRun.runInfo.triggerData}}
                    </span>
                </div>
                <div class="col-md-4">
                    <span ng-if="validationRun.runInfo.runTime">
                        <ot-duration duration="validationRun.runInfo.runTime"></ot-duration>
                    </span>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="modal-footer">
    <button class="btn btn-default" type="button" ng-click="navigate(validation.validationStamp.validationRunsPaginated.pageInfo.previousPage)" ng-show="validation.validationStamp.validationRunsPaginated.pageInfo.previousPage">
        <span class="fa fa-step-backward"></span>
        Newest
    </button>
    <button class="btn btn-default" type="button" ng-click="navigate(validation.validationStamp.validationRunsPaginated.pageInfo.nextPage)" ng-show="validation.validationStamp.validationRunsPaginated.pageInfo.nextPage">
        <span class="fa fa-step-forward"></span>
        Oldest
    </button>
    <button class="btn btn-primary" type="submit" ng-click="cancel()">OK</button>
</div>